JS_based animation - matrix rain animation

Revision:


code:
			<div class="frame1">
				<canvas>
		
				</canvas>
			</div>
			<style>
				.frame1 * {margin: 0; padding: 0}
				.frame1 {background: #000; width: 35vw; height: 30vw;}
				canvas {display: block;}
			</style>
			<script>
				var canvas = document.querySelector('canvas'),
				ctx = canvas.getContext('2d');
				canvas.width = window.innerWidth/3;
				canvas.height = window.innerHeight/3;
				var letters = 'ABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRS
				TUVXYZABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZA
				BCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZ';
				letters = letters.split('');
				var fontSize = 10, columns = canvas.width / fontSize;
				// Setting up the drops
				var drops = [];
				for (var i = 0; i < columns; i++) {
				drops[i] = 1;
				}
				function draw() {
				ctx.fillStyle = 'rgba(0, 0, 0, .1)';
				ctx.fillRect(0, 0, canvas.width, canvas.height);
				for (var i = 0; i < drops.length; i++) {
					var text = letters[Math.floor(Math.random() * letters.length)];
					ctx.fillStyle = '#0f0';
					ctx.fillText(text, i * fontSize, drops[i] * fontSize);
					drops[i]++;
					if (drops[i] * fontSize > canvas.height && Math.random() > .95) {
					drops[i] = 0;
					}
				}
				}
		
				// Loop the animation
				setInterval(draw, 33);
			</script>